package com.coocaa.x.provider.xprovider;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

/**
 * Created by lu on 15-12-22.
 */
public interface IProviderHandler {
    public class ProviderHandlerNotHandledException extends Exception {
        private static final String ERROR = " not handled!";

        public ProviderHandlerNotHandledException(Uri uri) {
            super(uri.toString() + ERROR);
        }
    }

    boolean onCreate(Context c);

    String getType(Uri uri) throws ProviderHandlerNotHandledException;

    Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) throws ProviderHandlerNotHandledException;

    Uri insert(Uri uri, ContentValues values) throws ProviderHandlerNotHandledException;

    int delete(Uri uri, String selection, String[] selectionArgs) throws ProviderHandlerNotHandledException;

    int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) throws ProviderHandlerNotHandledException;
}
